//
//  MingShiTencentSessionDelegate.m
//  MingShi
//
//  Created by MJiao on 15/7/12.
//  Copyright (c) 2015年 MJiao. All rights reserved.
//

#import "MingShiTencentSessionDelegate.h"
#import "MingShiConfig.h"

static MingShiTencentSessionDelegate *g_instance = nil;

@implementation MingShiTencentSessionDelegate


- (void)tencentDidLogin
{
    [[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessed object:self];
}

- (void)tencentDidNotLogin:(BOOL)cancelled
{
    [[NSNotificationCenter defaultCenter] postNotificationName:kLoginFailed object:self];
}

- (void)tencentDidNotNetWork
{
    [[NSNotificationCenter defaultCenter] postNotificationName:kLoginFailed object:self];
}

- (void)getUserInfoResponse:(APIResponse*) response
{
    
    [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserInfoResponse object:self  userInfo:[NSDictionary dictionaryWithObjectsAndKeys:response, kResponse, nil]];
}
+ (MingShiTencentSessionDelegate *)getinstance {
    @synchronized (self) {
        if (nil == g_instance) {
            g_instance = [[MingShiTencentSessionDelegate alloc] init];


        }
    }

    return g_instance;
}
/**
 *  （1） 创建TencentOAuth并初始化其appid，demo为222222。delegate为实现TencentSessionDelegate的对象
 *
 */
- (id)init
{
//    if (self = [super init])
//    {
    
    NSString *appid = @"1104658203";
    _oauth = [[TencentOAuth alloc] initWithAppId:appid
                                     andDelegate:self];

    //}
    return self;
}



@end
